﻿using System.Linq;
using wd2now.Framework.Bots;
using wd2now.Model.Actions;
using wd2now.Model.Table;

namespace Demo.Bots.PreFlop
{
    public class PushBot : IBot
    {
        public bool CanPlay(Table table)
        {
            if (table.Round == BettingRound.PreFlop)
            {
                return true;
            }

            return false;
        }

        public Action Play(Table table)
        {
            var hero = table.Players.SingleOrDefault(p => p.Hero);

            if (hero != null && hero.Cards.Any(c => c.Rank >= 10))
            {
                return new Action
                    {
                        Amount = hero.Balance,
                        Type = ActionType.BetRaise,
                    };
            }

            return new Action { Type = ActionType.CheckFold, };
        }
    }
}
